<?php use_helper('Javascript') ?>

<?php if ($categories):?>
<div>
<ul>
	<?php foreach($categories as $categories):?>
		<li class=categories><?php echo link_to( $categories->getCategoriesName() , 'categories/subcategories?parent='.$categories->getCategoriesId())?></li><br/>
	<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>


<?php if ($products):?>
    <table>
    <?php $i = 0 ?>
      <tr align="center">
	    <?php foreach($products as $products):?>
	      <?php if($i % 1 == 0): ?>
	        <?php $i = 0 ?>
	        </tr><tr>
	      <?php endif; ?>
	      <td>
	        <?php echo image_tag(sfConfig::get('sf_upload_dir_name').'/products/thumbnails/'.$products->getProductsImage(), array('id' => 'products_'.$products->getProductsId(), 'class' => 'products')) ?>
          </td><td><?php echo link_to( $products->getProductsName(sfContext::getInstance()->getUser()->getCulture()).substr($products->getProductsDescription(sfContext::getInstance()->getUser()->getCulture()), 0, 100), 'categories/products?products='.$products->getProductsId()) ?>
		      <?php echo draggable_element('products_'.$products->getProductsId(), array('revert' => true)) ?>
		    </td>
		    <?php $i++ ?>
      <?php endforeach; ?>
	  </tr>
	  </table>
<?php endif; ?>
